#include <iostream>
using namespace std;

struct result{
    int q;
    int r;
};

result divide(int x, int y)
{
    result r;

    if (x == 0){
        r.q = r.r = 0;
        return r;
    }

    r = divide(x/2, y);
    r.q *= 2; r.r *= 2;
    if (x % 2 == 1) r.r++;
    if (r.r >= y){
        r.r -= y;
        r.q++;
    }

    return r;
}

void exam02(void)
{
    result r;

    r = divide(971, 3);
    cout << r.q << "\t" << r.r << endl;
}
